package org.gdgbologna.resources;

import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;

public class Session implements Parcelable{
	public String title;
	public ArrayList<Talk> talks;
	public String date;
	
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(title);
		dest.writeString(date);
		dest.writeTypedList(talks);
	}

	public Session (Parcel in) {
		this();
		title = in.readString();
		date = in.readString();
		in.readTypedList(talks, Talk.CREATOR);
	}
	
	public Session(){
		talks = new ArrayList<Talk>();
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public ArrayList<Talk> getTalks() {
		return talks;
	}
	
	public void addTalk(Talk toAdd){
		talks.add(toAdd);
	}
	
	public void removeTalk(Talk toRemove){
		talks.remove(toRemove);
	}
	
	public String toString(){
		return title;
	}


	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public static final Parcelable.Creator<Session> CREATOR = new Parcelable.Creator<Session>() {

		public Session createFromParcel(Parcel source) {
			return new Session(source);
		}

		@Override
		public Session[] newArray(int size) {
			// TODO Auto-generated method stub
			return new Session[size];
		}

	};
	
}
